﻿using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Snake.Data
{
    class File
    {
        public static string Read(string filePath)
        {
            try
            {
                if (filePath == null)
                    throw new InvalidBarrierPathException();
                StreamReader streamReader = new StreamReader(filePath);
                return streamReader.ReadToEnd();
            }
            catch(InvalidBarrierPathException)
            {
                return "";
            }

        }

        public class InvalidBarrierPathException:Exception
        {
            public override string Message => "文件读取失败";
        }

    }
}
